Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixes Stack Overflow and Memory Management Issues #542

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brawncode
Copy link

I've made some improvements to address stack overflow issues and enhance memory management.

Key Changes:

  • Increased Stack Size:
    The stack size has been increased to 2048 bytes for overflow_stack and 8192 bytes for allocate_stack_with_increased_size to prevent stack overflow errors. These values can be adjusted as per your system requirements.

  • Replaced Array with Vec:
    The static array in overflow_stack has been replaced with a dynamic Vec<u32>, which allocates memory on the heap, eliminating the risk of stack overflow.

  • Memory Management in overflow_heap:
    I introduced a variable to track the allocated memory in overflow_heap. Additionally, I added an exit condition when the total allocated memory exceeds 100MB to prevent infinite memory allocation.

  • Optimized memory_size Attribute:
    The memory_size attribute in #[jolt::provable(memory_size = 8192)] has been updated to 8MB, allowing the function to handle larger memory sizes, which is particularly useful when allocating multiple vectors.

These changes should resolve the stack overflow and memory issues, improving stability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant